package com.yhl.sftp;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


public class PropertiesUtil {
	private static 	 Log log = LogFactory.getLog(PropertiesUtil.class);
public static Properties getProp(String filePath){
	
	InputStream in =null;
	Properties prop = null;
	try {
		prop = new Properties();
		in = new BufferedInputStream(PropertiesUtil.class.getClassLoader().getResourceAsStream(filePath));
		prop.load(in);
	} catch (IOException e) {
		log.error("read properties error "+e.getMessage());
	}finally{
		log.info("read properties close stream ");
		try {
			in.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			log.error("read properties close stream error "+e.getMessage());
		}
	}
	return prop;

}

	public static void main(String[] args) {
		Properties props = PropertiesUtil.getProp("iptFlow.properties");
		//System.out.println(props.get("BILLFTP_FTPHOS"));
		System.out.println(props.getProperty("email.server.ip"));


	}
}
